﻿using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AutoCAD.EntityTools.Views
{
    /// <summary>
    /// PaletteView.xaml 的交互逻辑
    /// </summary>
    public partial class PaletteView : UserControl
    {
        public PaletteView()
        {
            InitializeComponent();
        }

        #region EntityTools 测试方法
        private void GetEntityInfo_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("正在获取实体信息...");

            try
            {

                   ("\nAutoCAD.EntityTools 测试消息\n").CadMessage2();
            }
            catch (System.Exception ex)
            {
                ShowStatus($"错误: {ex.Message}");
            }
        }

        private void CopyEntity_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("复制实体功能");
            // 实现复制实体逻辑
        }

        private void MoveEntity_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("移动实体功能");
            // 实现移动实体逻辑
        }
        #endregion

        #region PointTools 测试方法
        private void CreatePoint_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("创建点功能");
            // 实现创建点逻辑
        }

        private void CalculateDistance_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("计算距离功能");
            // 实现距离计算逻辑
        }

        private void Midpoint_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("中点计算功能");
            // 实现中点计算逻辑
        }
        #endregion

        #region LayerTools 测试方法
        private void CreateLayer_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("创建图层功能");
            // 实现创建图层逻辑
        }

        private void SetCurrentLayer_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("设置当前图层功能");
            // 实现设置当前图层逻辑
        }

        private void ManageLayers_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("图层管理功能");
            // 实现图层管理逻辑
        }
        #endregion

        #region EditorTools 测试方法
        private void SelectEntities_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("选择实体功能");
            // 实现选择实体逻辑
        }

        private void ExecuteCommand_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("执行命令功能");
            // 实现命令执行逻辑
        }

        private void ShowMessage_Click(object sender, RoutedEventArgs e)
        {

                ("\nAutoCAD.EntityTools 测试消息\n").CadMessage2();
                ShowStatus("消息已发送到命令行");

        }
        #endregion

        #region BlockTools 测试方法
        private void CreateBlock_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("创建图块功能");
            // 实现创建图块逻辑
        }

        private void InsertBlock_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("插入图块功能");
            // 实现插入图块逻辑
        }

        private void ManageBlockAttributes_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("块属性管理功能");
            // 实现块属性管理逻辑
        }
        #endregion

        #region 通用方法
        private void ShowStatus(string message)
        {
            StatusText.Text = message;
        }

        private void Refresh_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("界面已刷新");
        }

        private void Help_Click(object sender, RoutedEventArgs e)
        {
            ShowStatus("查看帮助文档: https://github.com/your-repo/AutoCAD.EntityTools");
        }

        private void Close_Click(object sender, RoutedEventArgs e)
        {
            var parentWindow = System.Windows.Window.GetWindow(this);
            parentWindow?.Close();
        }
        #endregion
    }
}
